SEL block

Short summary

Name

SEL

→POU type

→function

Category

Standard (safe), Select

Conform to →IEC-standard

(error) currently restricted
(IEC demands data type ANY for the inputs and the return value. Hence the following data types are demanded as well: LTIMEWSTRINGWCHARLDATE_AND_TIMELTIME_OF_DAY and LDATE. Currently, these data types are not supported for the block.) 

Graphical interface

Available since

version 1.21.0 (for Neuron Power Engineer) – initial variant

version 1.109.0 (for Neuron Power Engineer) – enhancement: STRING , CHAR, user-defined data types and references for IN1, IN2 and for the return value

version 3.8.0 (for library Standard (safe)): block provided in this library

Functionality

The block makes a binary selection.

If input G is set to value FALSE (or an equivalent), the block returns the value of input IN0. If input G is set to value TRUE (or an equivalent), the block returns the value of input IN1.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

G

BOOL

selector

IN1

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

1st value

IN2

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

2nd value

Return value:

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
    VAR
        result1 : INT;
        result2 : DINT;
    END_VAR
    result1 := SEL(G := FALSE, IN0 := INT#1, IN1 := USINT#2);    (* The variable 'result' evaluates to '1'. *)
    result2 := SEL(G := TRUE, IN0 := DINT#1, IN1 := USINT#2);   (* The variable 'result' evaluates to '2'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.